﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DbGenerator.Factory.events
{
    public delegate void DGenerationEventHandler(object sender, TFactoryArgs args);

    public static class SFactoryEventManager
    {
        private static DGenerationEventHandler GenerationEventHandler;
        private static DGenerationEventHandler ReadDatabaseEventHandler;
        public static event DGenerationEventHandler GenerationEvent
        {
            add { GenerationEventHandler += value; }
            remove { GenerationEventHandler -= value; }
        }
        public static event DGenerationEventHandler ReadDatabaseEvent
        {
            add { ReadDatabaseEventHandler += value; }
            remove { ReadDatabaseEventHandler -= value; }
        }
        public static void OnGeneration(object sender, TFactoryArgs args)
        {
            if (GenerationEventHandler != null)
                GenerationEventHandler(sender, args);
        }
        public static void OnReadDatabase(object sender, TFactoryArgs args)
        {
            if (ReadDatabaseEventHandler != null)
                ReadDatabaseEventHandler(sender, args);
        }
    }
}
